"""

Kdar Main module 


"""

import sys

from pykd import *
                 
def info():
    dprintln( "\nKDAR. Info" )

def config():
    dprintln( "\nKDAR. Config tool" )   

def startAnalyze():
    
    dprintln( "\nKDAR. Analyze tool" )
    
    import tests.kernel.kernel as kernelTests
    import tests.drivers.filesys as filesysTests    

# TODO:  this list must be built by testBuilderClass
    testList = ( 
#        kernelTests.kernelModuleTest(),
#        kernelTests.ssdt.ssdtTest(),
#        kernelTests.idt.idtTest(),
#        kernelTests.threads.threadsTest(),
        kernelTests.callback.callbackTest(),
#        filesysTests.filesysTest() 
        )

    for test in testList: test.analyze()

    dprintln("\nKDAR Report:\n")
    
    dprintln("TREATS:\n")        
    for test in testList: test.printTreats()
    
    dprintln("\nWARNINGS:\n")
    for test in testList: test.printWarnings()
    


def loadMemoryDump( dumpFile ):

    if loadDump( dumpFile ):
        dprintln( "KDAR. python version" )      
        dprintln( "\nKDAR. Load memory dump tool" )
        dprintln( "loading dump ... OK" )
        return True
    else:
        return False
            


if __name__ == "__main__":

    if not isWindbgExt():
        if not loadMemoryDump( sys.argv[1] ):
            quit( 0 )
    else:
        dprintln( "\nKDAR. python version" )    

    startAnalyze()



  
